/* 全局样式 - 适用于所有页面 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.2s ease;
    --search-height: 2.5rem;
    --search-gap: 6px;
}
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

/* 按钮样式 - 全局通用 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn.secondary {
    background-color: var(--border-color);
    color: var(--text-color);
}

.btn.secondary:hover {
    background-color: #cbd5e1;
    transform: translateY(-1px);
}

.btn.icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: 0.375rem;
    transition: var(--transition);
}

.btn.icon:hover {
    transform: translateY(-1px);
}

.btn.edit {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.btn.edit:hover {
    background-color: rgba(16, 185, 129, 0.2);
}

.btn.delete {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.btn.delete:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

/* 生成试卷按钮样式 */
.btn.generate {
    background-color: rgba(59, 130, 246, 0.1); /* 蓝色背景，与预览按钮呼应 */
    color: #3b82f6; /* 蓝色图标 */
}

.btn.generate:hover {
    background-color: rgba(59, 130, 246, 0.2);
}

/* 发布考试按钮样式 */
.btn.publish {
    background-color: rgba(16, 185, 129, 0.1); /* 绿色背景，与编辑按钮呼应 */
    color: #10b981; /* 绿色图标 */
}

.btn.publish:hover {
    background-color: rgba(16, 185, 129, 0.2);
}

/* 表单元素样式 - 全局通用 */
.form-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.form-group label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    transition: var(--transition);
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label {
    top: 0;
    font-size: 0.75rem;
    background-color: var(--card-bg);
    padding: 0 0.25rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: white;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11l4-4H4l4 4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 登录页面样式 */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background-color: var(--bg-color);
    background-image:
            radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
            radial-gradient(circle at 75% 75%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
}

.login-card {
    width: 100%;
    max-width: 350px;
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.login-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.logo i {
    color: var(--primary-color);
    font-size: 2rem;
    margin-right: 0.5rem;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--text-color);
}

.login-header p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.login-form .btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
}

.login-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
}

.login-links a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.login-footer {
    color: var(--text-light);
    font-size: 0.75rem;
    text-align: center;
}

/* 学生管理页面样式 */
.student-management-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    height: 4rem;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.main-header .logo {
    margin-bottom: 0;
}

.user-menu {
    display: flex;
    align-items: center;
}

.username {
    margin-right: 1rem;
    font-size: 0.875rem;
}

.user-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    transition: var(--transition);
}

.user-avatar:hover {
    border-color: var(--primary-color);
}

.main-container {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 4rem);
}

.sidebar {
    width: 16rem;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    transition: var(--transition);
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.875rem;
}

.sidebar-nav a i {
    width: 1.25rem;
    margin-right: 0.75rem;
    color: var(--text-light);
    transition: var(--transition);
}

/*左边列表选择样式*/
.sidebar-nav li.active a {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

.sidebar-nav li.active a i {
    color: var(--primary-color);
}

.sidebar-nav a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-nav a:hover i {
    color: var(--primary-color);
}

/* 内容盒子切换样式 */
.content-box {
    display: none; /* 默认隐藏所有盒子 */
}

.content-box.active {
    display: block; /* 活跃的盒子显示 */
}


.content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.content-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* 筛选栏样式 - 确保筛选框在右侧 */
.filter-bar {
    display: flex;
    justify-content: space-between; /* 关键：左右元素分离 */
    align-items: center;
    width: 100%; /* 确保占满容器宽度 */
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-boxes {
    flex: 1; /* 搜索区域占据左侧所有可用空间 */
    min-width: 300px; /* 确保小屏幕有合理宽度 */
}

.filter-options {
    white-space: nowrap; /* 防止筛选框换行 */
    display: flex;
    gap: 1rem;
}

.card {
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.data-table th {
    background-color: var(--primary-light);
    font-weight: 600;
    color: var(--text-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: var(--primary-light);
    transform: translateX(2px);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
}

.btn.page {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    transition: var(--transition);
}

.btn.page:hover:not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn.page.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-form {
    padding: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.modal-form .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.modal-form .form-group label {
    position: static;
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transform: none;
}

.modal-form .form-group input,
.modal-form .form-group select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: var(--transition);
}

.modal-form .form-group input:focus,
.modal-form .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.sidebar-nav li.disabled a {
    color: #999;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.7;
}

/* 搜索框样式 */
.search-box {
    display: flex;
    flex: 1;
    max-width: 50rem;
    height: var(--search-height);
    gap: var(--search-gap);
}

.search-input {
    flex: 1;
    padding: 0 1rem;
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
    transition: var(--transition);
    height: 100%;
    border-radius: 0.375rem;
}

.search-btn {
    background-color: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
    padding: 0 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: var(--transition);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: var(--search-gap);
}

.search-btn:hover {
    background-color: var(--primary-dark);
}

.search-btn.active {
    transform: scale(0.95);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 响应式设计 - 适配所有页面 */
@media (max-width: 768px) {
    .sidebar {
        width: 4rem;
    }

    .sidebar-nav a span {
        display: none;
    }

    .sidebar-nav a {
        justify-content: center;
        padding: 0.75rem;
    }

    .sidebar-nav a i {
        margin-right: 0;
        font-size: 1.25rem;
    }

    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-boxes {
        width: 100%;
    }

    .search-box {
        max-width: none;
        width: 100%;
        flex-direction: column;
        height: auto;
        gap: 8px;
    }

    .search-input, .search-btn {
        width: 100%;
        margin-left: 0;
    }

    .filter-options {
        width: 100%;
        justify-content: flex-start;
    }

    .filter-options select {
        flex: 1;
        width: 100%;
    }

    .data-table {
        font-size: 0.75rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    /* 登录页面响应式 */
    .login-card {
        padding: 1.5rem;
        max-width: 100%;
    }

    /* 针对生成考卷弹框单独优化，保持与其他弹框样式区分 */
    #generate-exam-modal {
        --gap: 16px; /* 统一间距变量，方便调整 */
        --input-height: 36px;
        --textarea-rows: 4;
    }

    #generate-exam-modal .modal-content {
        background-color: #fdf5d9; /* 模拟目标浅黄色背景，可根据实际需求调整 */
        border: 1px dashed #ccc; /* 模拟目标虚线边框，和第二张图呼应 */
    }

    #generate-exam-modal .modal-form {
        padding: var(--gap);
    }

    #generate-exam-modal .form-row {
        display: block;
        margin-bottom: var(--gap);
    }

    #generate-exam-modal .form-group {
        display: flex;
        align-items: center;
        min-width: auto;
    }

    #generate-exam-modal .form-group label {
        flex: 0 0 80px; /* 固定标签宽度，让文本对齐更整齐 */
        text-align: right;
        margin-right: 8px;
        font-size: 0.875rem;
        font-weight: 500;
    }

    #generate-exam-modal .form-control {
        flex: 1;
        height: var(--input-height);
        padding: 0 8px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 0.875rem;
        box-sizing: border-box;
    }

    #generate-exam-modal #exam-remark {
        height: auto;
        min-height: calc(var(--input-height) * var(--textarea-rows));
        padding: 8px;
        resize: vertical; /* 允许垂直拉伸 */
    }

    #generate-exam-modal .form-actions {
        justify-content: center; /* 如果想让按钮居中，可调整这里；默认靠右就去掉 */
        margin-top: var(--gap);
    }

    #generate-exam-modal .btn {
        padding: 8px 16px;
        border-radius: 4px;
        border: none;
        cursor: pointer;
        transition: opacity 0.3s ease;
    }

    #generate-exam-modal .btn-secondary {
        background-color: #fff;
        color: #333;
        border: 1px solid #ccc;
    }

    #generate-exam-modal .btn-primary {
        background-color: #333;
        color: #fff;
    }

    #generate-exam-modal .btn:hover {
        opacity: 0.8;
    }

    /* 按钮 loading 样式，需要引入 font-awesome 图标库 */
    .btn.loading {
        pointer-events: none; /* 禁止点击 */
    }
    .btn.loading i {
        margin-right: 5px;
    }

    /* 弹窗内容区域滚动条相关（核心新增，让内容超出有滚动条） */
    #exam-preview-content {
        overflow-y: auto !important;
        flex: 1 !important;
        padding: 1.5rem !important;
        box-sizing: border-box !important;
        height: calc(100% - 40px) !important; /* 调整 40px 为实际头部高度 */
    }

    /* 弹窗整体固定宽高（若原有 modal-content 没做固定，新增此规则） */
    #exam-preview-modal .modal-content {
        width: 900px !important;
        height: 700px !important;
        max-width: 900px !important;
        max-height: 700px !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    /* 弹窗底部按钮区域（新增，若有底部按钮可统一边距） */
    #exam-preview-modal .modal-footer {
        padding: 1.5rem; /* 和 modal-form、内容区域统一 */
        border-top: 1px solid var(--border-color);
        display: flex;
        justify-content: flex-end;
        gap: 1rem;
    }

    /* 以下是为了让弹窗显示/隐藏动画更贴合固定尺寸需求（若原有 transition 不满足新增） */
    #exam-preview-modal {
        z-index: 99999 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        opacity: 0 !important;
        transition: opacity 0.3s ease !important;
    }
    #exam-preview-modal.show {
        opacity: 1;
    }
    #exam-preview-modal .modal-content {
        transform: translateY(-20px);
        transition: transform 0.3s ease;
    }
    #exam-preview-modal.show .modal-content {
        transform: translateY(0);
    }

    /* 可选：隐藏滚动条样式（美观优化，不影响功能） */
    #exam-preview-content::-webkit-scrollbar {
        width: 8px;
    }
    #exam-preview-content::-webkit-scrollbar-thumb {
        background-color: #ccc;
        border-radius: 4px;
    }
    #exam-preview-content::-webkit-scrollbar-track {
        background-color: #f5f5f5;
    }

}

#ai-analysis-modal .modal-content {
    max-width: 600px;
    width: 90%;
}

#ai-analysis-modal .modal-body {
    padding: 20px;
}

#ai-analysis-modal .analysis-result {
    margin-bottom: 20px;
}

#ai-analysis-modal .analysis-result label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

#ai-analysis-modal #ai-analysis-text {
    width: 100%;
    min-height: 200px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

#ai-analysis-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 15px 20px;
    border-top: 1px solid #eee;
}
#ai-analysis-text {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    white-space: pre-wrap;
    background: #f9f9f9;
}

/* 添加到style.css中 */
#ai-analysis-modal .modal-content {
    max-width: 800px;
    width: 90%;
}

#ai-analysis-text {
    width: 100%;
    min-height: 400px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
}

.analysis-result {
    margin-bottom: 20px;
}

.analysis-result label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}
/* 不带头像的用户菜单样式 */
.user-menu {
    position: relative;
    display: inline-block;
}

.username {
    color: #1e40af;
    font-weight: 600;
    padding: 10px 15px;
    border-radius: 6px;
    background-color: #f1f5f9;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.username:hover {
    background-color: #bfdbfe;
}

/* 弹窗样式（与带头像版通用，可复用） */
.admin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f1f5f9;
}

.modal-header h3 {
    margin: 0;
    color: #1e40af;
}

.close-modal {
    cursor: pointer;
    font-size: 20px;
    color: #64748b;
}

.close-modal:hover {
    color: #dc2626;
}

.modal-body {
    padding: 20px;
}

.info-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #e2e8f0;
}

.info-item:last-child {
    border-bottom: none;
}

.info-item strong {
    display: inline-block;
    width: 120px;
    color: #64748b;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
    text-align: right;
}

.logout-btn {
    padding: 8px 16px;
    background-color: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.logout-btn:hover {
    background-color: #b91c1c;
}

.loading {
    text-align: center;
    color: #64748b;
    padding: 20px 0;
}